package com.gusto.engine.beans.aspects.statistics;

import org.apache.log4j.Logger;

/**
 * <p>Object that will hold the access statistics 
 * (from the underlying repository or from the cache). 
 * It is used by the {@link StatisticsAspect} aspect.</p>
 * 
 * @author amokrane.belloui@gmail.com
 *
 */
public class ResStatistics {
	
	private Logger log = Logger.getLogger(getClass());
	
	private Long fromRepos = 0L;
	private Long fromCache = 0L;
	 
	public ResStatistics() {
		super();
		log.info("ResStatistics initialized");
	}
	
	public Long getFromRepos() {
		return fromRepos;
	}
	
	public Long getFromCache() {
		return fromCache;
	}
	
	public void increaseFromCache() {
		fromCache ++;
	}
	
	public void increaseFromRepos() {
		fromRepos ++;
	}
	
	public void reinit() {
		fromRepos = 0L;
		fromCache = 0L;
		log.info("Reinitializing counters");
	}
	
}
